package com.kordar.api.modular.unicomJS;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import javax.validation.constraints.NotEmpty;

@Data
public class ZOPSubmitRequestImpl implements Request {

    @NotEmpty(message = "{zop.thirdOrderId}{javax.validation.constraints.NotEmpty.message}")
    private String thirdOrderId;
    @NotEmpty(message = "{zop.goodsId}{javax.validation.constraints.NotEmpty.message}")
    private String goodsId;
    @NotEmpty(message = "{zop.provinceCode}{javax.validation.constraints.NotEmpty.message}")
    private String provinceCode;
    @NotEmpty(message = "{zop.cityCode}{javax.validation.constraints.NotEmpty.message}")
    private String cityCode;
    @NotEmpty(message = "{zop.phoneNum}{javax.validation.constraints.NotEmpty.message}")
    private String phoneNum;
    @NotEmpty(message = "{zop.token}{javax.validation.constraints.NotEmpty.message}")
    private String token;

    /**
     * thirdOrderId	body	是	String		接入方订单号TP+拼接25位字符串,和预约单保持一致
     * goodsId	body	是	String		商品ID
     * provinceCode	body	是	String		订购号码省份编码
     * cityCode	body	是	String		订购号码地市编码
     * phoneNum	body	是	String		订购号码
     * createTime	body	是	String		订单创建时间 (yyyy-MM-dd HH:mm:ss)
     * token	body	是	String		预下单返回token
     * @return JSONObject
     */
    @Override
    public JSONObject body() {
        JSONObject object = new JSONObject();
        object.put("thirdOrderId", thirdOrderId);
        object.put("goodsId", goodsId);
        object.put("provinceCode", provinceCode);
        object.put("cityCode", cityCode);
        object.put("phoneNum", phoneNum);
        object.put("createTime", SysParams.getTimestamp());
        object.put("token", token);
        return object;
    }

    @Override
    public String url() {
        return "http://58.240.52.214:80/jszop/zop_link/orderSync?secretKey=" + SysParams.SYS_SECRET_KEY.getName();
    }
}
